<template>
    <div class="page">
        <tabs :options="tabs" v-model="tabsActive" @onclick="handleNavClick"/>
        <router-view ref="ref-router-children"/>
    </div>
</template>

<style lang="less" scoped>
    .page{
        .btn-box{
            .btn-item{
                width: 12.5rem;
                float: left;
                line-height: 3.3rem;
                font-size: 1.1rem;
                text-align: center;

                img{
                    height: 1rem;
                    vertical-align: bottom;
                    margin: 1.15rem .4rem;
                }
            }
        }
    }
</style>

<script>
    export default {
        data(){
            let tabsActive = 0;
            const type = this.$route.params.type;
            if(type){
                tabsActive = parseInt(type.match(/\d+$/));
            }
            return {
                tabs: ['债券', '非标'],
                tabsActive,
            }
        },
        methods: {
            handleNavClick(key){
                if(key == 0){
                    this.$router.replace('/same/assets');
                }else{
                    this.$router.replace('/same/assets/type' + key);
                }
            },

            onNavEvent(key){
                const ref = this.$refs['ref-router-view'];
                ref && ref.onNavEvent && ref.onNavEvent(key);
            }
        }
    }
</script>